<%@page contentType="text/html; charset=UTF-8"%>
<%@taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@include file="/common/definition.jsp"%>

<html:html>
<tiles:insert beanName="admin-definition" flush="true">
	<tiles:put name="title"> Administrator Management </tiles:put>
	<tiles:put name="body" type="string">

		<div class="col-md-12 mainHome">
		<div class="col-md-12 text-center h2 borderBot">Quản lý sản phẩm</div>
			<table id="Result"
				class="table table-striped table-hover table-condensed m-melanin-datatable">
				<thead>
					<tr>
						<th class="col-md-1">ID</th>
						<th class="col-md-2">Hình Ảnh</th>
						<th class="col-md-6"><font size="2">Tên Sản Phẩm</font></th>
						<th class="col-md-3"><font size="2">Quản Lý</font></th>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="productModel.listProduct">
						<tr>
							<td class="col-md-1">
								<s:property value="productID"/>
							</td>
							<td class="col-md-2 text-center">
								<s:if test="mainImgLink == null">
									<img style="height: 100%" width=100% src='img/avatar/no_product_img.jpg'>
								</s:if> <s:else>
									<img style="height: 100%" width=100%
										src='<s:property value="mainImgLink"/>'>
								</s:else></td>
							<td class="col-md-7">
								<s:a action="clickDetailProduct">
									<s:property value="catName" />
									<s:property value="brandName" />
									<s:property value="productName" />
									<s:param name="productID"><s:property value="productID"/></s:param>
								</s:a>
							</td>
							<td class="col-md-2"><div class="btn-group">
									<s:a action="detailProductLink">Thông tin sản phẩm<s:param name="productID" value="productID"/></s:a><br>
									<s:a action="imageManage-page">Hình Ảnh sản phẩm<s:param name="productID" value="productID"/></s:a><br>
								</div>
							</td>
						</tr>
					</s:iterator>
				</tbody>
			</table>
		</div>
		<script type="text/javascript" src="js/jquery.dataTables.js"></script>
		<script src="js/datatables.js"></script>
		<script type="text/javascript">
			$(document)
					.ready(
							function() {
								$('#Result')
										.dataTable(
												{
													"sPaginationType" : "bs_full",
													"oLanguage" : {
														"sSearch" : "",
														"sZeroRecords" : "Không có dữ liệu",
														"sEmptyTable" : "Không có dữ liệu",
														"sInfo" : "Hiển thị từ _START_ đến _END_. Tổng cộng: _TOTAL_ dòng.",
														"sInfoFiltered" : "",
														"sLengthMenu" : "Hiển thị _MENU_ Dòng",
														"sInfoEmpty" : 'Không tìm thấy dữ liệu.'
													}
												});
								$('#Result')
										.each(
												function() {
													var datatable = $(this);
													// SEARCH - Add the placeholder for Search and Turn this into in-line form control
													var search_input = datatable
															.closest(
																	'.dataTables_wrapper')
															.find(
																	'div[id$=_filter] input');
													search_input.attr(
															'placeholder',
															'Tìm Nhanh');
													search_input
															.addClass('form-control input-sm');
													// LENGTH - Inline-Form control
													var length_sel = datatable
															.closest(
																	'.dataTables_wrapper')
															.find(
																	'div[id$=_length] select');
													length_sel
															.addClass('form-control input-sm');
												});
							});
		</script>

	</tiles:put>
</tiles:insert>
</html:html>

